package org.jeecg.modules.es.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * TODO:
 *
 * @author Zhang Hao yu
 * @date 2020/12/25 15:53
 */
@Data
public class KnowledgeVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private java.lang.String id;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private java.lang.String createBy;
    /**创建日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private java.util.Date createTime;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private java.lang.String updateBy;
    /**更新日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private java.util.Date updateTime;
    /**所属部门*/
    @ApiModelProperty(value = "所属部门")
    private java.lang.String sysOrgCode;
    /**知识标题*/
    @Excel(name = "知识标题", width = 15)
    @ApiModelProperty(value = "知识标题")
    private java.lang.String knowledgeTitle;
    /**作者*/
    @Excel(name = "作者", width = 15)
    @ApiModelProperty(value = "作者")
    private java.lang.String knowledgeAuthor;
    /**内容*/
    @Excel(name = "内容", width = 15)
    @ApiModelProperty(value = "内容")
    private java.lang.String knowledgeContent;
    /**知识类别*/
    @Excel(name = "知识类别", width = 15, dicCode = "articleClassfiy")
    @Dict(dicCode = "articleClassfiy")
    @ApiModelProperty(value = "知识类别")
    private java.lang.String knowledgeType;
    /**知识简介*/
    private java.lang.String knowledgeIntroduction;
    /**图片*/
    private java.lang.String knowledgeImageString;

    /**文章置顶  1置顶 0不置顶*/
    @ApiModelProperty(value = "文章置顶")
    private int knowledgeColumnTop;

    private byte[] knowledgeImage;

    public byte[] getKnowledgeImage(){
        if(knowledgeImageString==null){
            return null;
        }
        try {
            return knowledgeImageString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getKnowledgeImageString(){
        if(knowledgeImage==null || knowledgeImage.length==0){
            return "";
        }
        try {
            return new String(knowledgeImage,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
    /**关键字*/
    private List<String> keywordList;
    /**能否评论*/
    private java.lang.Integer knowledgeEnableComment;
    /**能否评论*/
    private java.lang.Integer knowledgeReadingNum;
}